package com.itcast.demoone.kotlin

// 单例类
object SettingManager {
    // 控制暗黑模式
    var isDarkMode: Boolean = false

    // 修改暗黑模式
    fun changeDarkMode() {
        this.isDarkMode = !this.isDarkMode
        println("暗黑模式 ${ if(this.isDarkMode) "已开启" else "已关闭" } ")
    }

}

fun main() {
    SettingManager.changeDarkMode() // 暗黑模式已开启
    SettingManager.changeDarkMode() // 暗黑模式已关闭
    SettingManager.changeDarkMode() // 暗黑模式已开启
}